<?php
namespace app\admin\controller;
use think\Controller;
use think\Session;
use think\Db;
class Login extends Controller
{
    public function login()
    { Session("name",null);
        return $this->fetch();
    }
	 public function userlogin()
	{
	 $name= $_POST["username"];
	 $pwd=$_POST["userpwd"];
	 $res=Db::name('backstage')
	 ->where(['manger_name'=>$name,'manger_pwd'=>$pwd])
	 ->select();
	
	 if($res){
	     Session::set("name",$name);
	  
	     $raw_success = array( 'msg' => 'ok');
	     return json($raw_success);
	 }
	 else {
	     $raw_success = array( 'msg' => 'no');
	     return json($raw_success);
	 }
	 
	}
	
}

